import { random, getZhanfa, getEnemyByZhanfa, randomItem, randomWujiang } from "./utils";
import { Wujiang, ZhuangTaiMap } from "./u";
import { isJijiu, lijiZhiliao, shanghai, zhiLiao } from "./app";
const isTuichu = (zhanBao: string[], u: Wujiang, zhanwei: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
  if (u.hp === 0) {
    zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>无法再战`);
    LR = LR.filter((item) => item !== u);
    zhanwei = zhanwei.filter((item) => item !== u);
    tuichuWujiangList.push(u);
  }
};
const isOut = (zhanBao: string[],LR: Wujiang[]) => {
  let l: Wujiang[] = LR.filter((item) => item.lr === "l");
  let r: Wujiang[] = LR.filter((item) => item.lr === "r");
  if (l[0].hp === 0) {
    zhanBao.push(`l 大营被击溃`);
    zhanBao.push(`游戏结束`);
    return true;
  }
  if (r[r.length - 1].hp === 0) {
    zhanBao.push(`r 大营被击溃`);
    zhanBao.push(`游戏结束`);
    return true;
  }
  return false;
};

export const beidongZhanfa = {
  百战精兵: (zhanBao: string[], l: Wujiang) => {
    l.atk += 32;
    l.v += 32;
    l.mou += 32;
    l.def += 32;
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动被动技能【百战精兵】提升32点,<span class="${l.lr}">【${l.name}】</span>攻击(${l.atk})、谋略(${l.mou})、防御(${l.def})、速度(${l.v})`);
  },
  血溅黄砂: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    l.zhuangtai.youyu.huihe = 9999;
    l.zhuangtai.youyu.laiyuan = l;
    l.zhuangtai.youyu.laiyuanZhanfa = "血溅黄砂";
    l.zhuangtai.youyu.jilv = 1;
    l.atk += Number((l.atk * (1 + 1.2)).toFixed(2));
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【血溅黄砂】,无法发动主动战法`);
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>攻击提升(${l.atk})`);
  },
};

export const zhihuiZhanfa = {
  空城: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【空城】`);
    l.zhuangtai.guibi.huihe = 2;
    l.zhuangtai.guibi.laiyuan = l;
    l.zhuangtai.guibi.laiyuanZhanfa = "空城";
    l.zhuangtai.guibi.jilv = 0.7;
    l.zhuangtai.guibi.num = 9999;
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的规避效果已施加`);
  },
  魏武之世: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【魏武之世】`);
    // 敌
    let list: Wujiang[];
    // 友
    let listY: Wujiang[];
    if (l.lr === "l") {
      list = rList;
      listY = lList;
    } else {
      listY = rList;
      list = lList;
    }
    const yuzhi = ((l.mou - 80) * 0.045 + 15) / 100;

    for (let u of list) {
      const atk = Number((u.atk * yuzhi).toFixed(2));
      const x = Number((l.mou - 80) * 0.045 + 15).toFixed(2);
      u.atk = Number((u.atk - atk).toFixed(2));
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的攻击属性降低了${x}%(${atk})(${u.atk})`);
      const def = Number((u.def * yuzhi).toFixed(2));
      u.def = Number((u.def - def).toFixed(2));
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的防御属性降低了${x}%(${def})(${u.def})`);
      const mou = Number((u.mou * yuzhi).toFixed(2));
      u.mou = Number((u.mou - mou).toFixed(2));
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的谋略属性降低了${x}%(${mou})(${u.mou})`);
      const v = Number((u.v * yuzhi).toFixed(2));
      u.v = Number((u.v - v).toFixed(2));
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的速度属性降低了${x}%(${v})(${u.v})`);
    }
    for (let u of listY) {
      u.distance += 1;
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的攻击距离增加1`);
    }
  },
  皇裔流离: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【皇裔流离】`);
    let list = lList;
    if (l.lr === "r") {
      list = rList;
    }
    for (let u of list) {
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的急救效果被施加`);
      u.zhuangtai.jijiu.huihe = 999;
      u.zhuangtai.jijiu.num = zhiLiao(zhanBao, l, 0.68, 0.006, 113.3);
      u.zhuangtai.jijiu.laiyuan = l;
      u.zhuangtai.jijiu.laiyuanZhanfa = "皇裔流离";
      u.zhuangtai.jijiu.jilv = 0.5;
    }
  },
  白衣渡江: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【白衣渡江】`);
    let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 2);
    if (arr.length > 0) {
      for (let u of arr) {
        zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的怯战效果被施加`);
        u.zhuangtai.qiezhan.huihe = 2;
        u.zhuangtai.qiezhan.laiyuan = l;
        u.zhuangtai.qiezhan.laiyuanZhanfa = "白衣渡江";
        u.zhuangtai.qiezhan.jilv = 1;
        u.zhuangtai.qiezhan.bukeqingchu = true;
        u.zhuangtai.celueshanghai.num = shanghai(zhanBao, l, u, 2.15, true);
        u.zhuangtai.celueshanghai.shoushang = [3];
        u.zhuangtai.celueshanghai.laiyuanZhanfa = "白衣渡江";
      }
    }
  },
  战必断金: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【战必断金】`);
    let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 4), 2);
    if (arr.length > 0) {
      for (let u of arr) {
        zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的怯战效果被施加`);
        u.zhuangtai.qiezhan.huihe = 3;
        u.zhuangtai.qiezhan.laiyuan = l;
        u.zhuangtai.qiezhan.laiyuanZhanfa = "战必断金";
        u.zhuangtai.qiezhan.jilv = 0.9;
        u.zhuangtai.qiezhan.bukeqingchu = true;
      }
    }
  },
  先驱突击: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【先驱突击】`);
    l.zhuangtai.lianji.huihe = 3;
    l.zhuangtai.lianji.laiyuan = l;
    l.zhuangtai.lianji.laiyuanZhanfa = "先驱突击";
    l.zhuangtai.lianji.jilv = 1;
    l.zhuangtai.lianji.bukeqingchu = true;
    l.atk += 30;
    l.zhuangtai.xianshou.huihe = 3;
    l.zhuangtai.xianshou.laiyuan = l;
    l.zhuangtai.xianshou.laiyuanZhanfa = "先驱突击";
    l.zhuangtai.xianshou.jilv = 1;
    l.zhuangtai.xianshou.bukeqingchu = true;
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的连击效果被施加,攻击提示至${l.atk}`);
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的先手效果被施加`);
  },
  反计之策: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【反计之策】`);
    let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 4), 2);
    if (arr.length > 0) {
      for (let u of arr) {
        zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的犹豫效果被施加`);
        u.zhuangtai.youyu.huihe = 1;
        u.zhuangtai.youyu.laiyuan = l;
        u.zhuangtai.youyu.laiyuanZhanfa = "反计之策";
        u.zhuangtai.youyu.jilv = 1;
        u.zhuangtai.youyu.bukeqingchu = true;
        u.zhuangtai.shanghaijiangdi.huihe = 3;
        u.zhuangtai.shanghaijiangdi.laiyuan = l;
        u.zhuangtai.shanghaijiangdi.laiyuanZhanfa = "反计之策";
        u.zhuangtai.shanghaijiangdi.jilv = 1;
        u.zhuangtai.shanghaijiangdi.bukeqingchu = true;
        zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的犹豫和伤害减免效果被施加`);
      }
    }
  },
};

export const zhuijiZhanfa = {
  温酒斩将: (zhanBao: string[], l: Wujiang, u: Wujiang, uList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("温酒斩将");
    if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【温酒斩将】`);
      const sh = shanghai(zhanBao, l, u, 2);
      u.hp -= sh;
      if (u.hp <= 0) {
        u.hp = 0;
      }
      zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
      isJijiu(zhanBao, u);
      isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
      if (isOut(zhanBao,LR)) {
        return true;
      }
    }
  },
};

export const zhudongZhanfa = {
  辕门射戟: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("辕门射戟");
    if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【辕门射戟】`);
      for (let j = 0; j < 2; j++) {
        if (getEnemyByZhanfa(zhanBao, l, uList, 5).length > 0) {
          const arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 2);
          for (let r of arr) {
            const sh = shanghai(zhanBao, l, r, 1.2);
            r.hp -= sh;
            if (r.hp <= 0) {
              r.hp = 0;
            }
            zhanBao.push(`<span class="${r.lr}">【${r.name}】</span>损失${sh}兵力(${r.hp})`);
            isJijiu(zhanBao, r);
            isTuichu(zhanBao, r, uList, tuichuWujiangList, LR);
            if (isOut(zhanBao,LR)) {
              return true;
            }
            if (j === 0) {
              r.zhuangtai.shanghaijiangdi.huihe = 1;
              r.zhuangtai.shanghaijiangdi.jiacheng = 0.1;
              zhanBao.push(`<span class="${r.lr}">【${r.name}】</span>的攻击伤害降低效果已施加`);
            }
          }
        } else {
          zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
        }
      }
    }
  },
  一骑当千: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("一骑当千");
    if (l.zhanfa.yqdq === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【一骑当千】`);

      let arr = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 3);
      if (arr.length > 0) {
        for (let u of arr) {
          const sh = shanghai(zhanBao, l, u, 2.8);
          u.hp -= sh;
          if (u.hp <= 0) {
            u.hp = 0;
          }
          zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
          isJijiu(zhanBao, u);
          isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
          if (isOut(zhanBao,LR)) {
            return true;
          }
        }
      }
      l.zhanfa.yqdq = 0;
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的战法【一骑当千】开始准备`);
      l.zhanfa.yqdq = 1;
    }
  },
  长坂之吼: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("长坂之吼");
    if (l.zhanfa.cbzh === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【长坂之吼】`);
      if (getEnemyByZhanfa(zhanBao, l, uList, 4).length > 0) {
        const arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 4), Math.random() < 0.5 ? 2 : 3);
        for (let u of arr) {
          const sh = shanghai(zhanBao, l, u, 4.8);
          u.hp -= sh;
          if (u.hp <= 0) {
            u.hp = 0;
          }
          zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
          isJijiu(zhanBao, u);
          isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
          if (isOut(zhanBao,LR)) {
            return true;
          }
        }
      }
      l.zhanfa.cbzh = 0;
    } else if (l.zhanfa.cbzh === 2) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的战法【长坂之吼】正在准备`);
      l.zhanfa.cbzh = 1;
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>的战法【长坂之吼】开始准备`);
      l.zhanfa.cbzh = 2;
    }
  },
  驱虎吞狼: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("驱虎吞狼");
    if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【驱虎吞狼】`);
      let arr = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 3);
      if (arr.length > 0) {
        for (let u of arr) {
          const sh = shanghai(zhanBao, l, u, 1.53, true);
          u.hp -= sh;
          if (u.hp <= 0) {
            u.hp = 0;
          }
          zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
          isJijiu(zhanBao, u);
          isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
          if (u.zhuangtai.weikun.huihe) {
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>已存在围困效果`);
          } else {
            u.zhuangtai.weikun.huihe = 2;
            u.zhuangtai.weikun.laiyuan = l;
            u.zhuangtai.weikun.laiyuanZhanfa = "驱虎吞狼";
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的围困效果已施加`);
          }
          if (isOut(zhanBao,LR)) {
            return true;
          }
        }
      } else {
        zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
      }
    }
  },
  浑水摸鱼: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    const data = getZhanfa("浑水摸鱼");
    if (l.zhanfa.hsmy === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【浑水摸鱼】`);
      l.zhanfa.hsmy = 0;
      let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 2);
      if (arr.length > 0) {
        for (let u of arr) {
          if (u.zhuangtai.hunluan.huihe) {
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>已存在混乱效果`);
          } else {
            u.zhuangtai.hunluan.huihe = 2;
            u.zhuangtai.hunluan.laiyuan = l;
            u.zhuangtai.hunluan.laiyuanZhanfa = "浑水摸鱼";
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的混乱效果已施加`);
          }
        }
      } else {
        zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
      }
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>战法【浑水摸鱼】开始准备`);
      l.zhanfa.hsmy = 1;
    }
  },
  妖术: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    const data = getZhanfa("妖术");
    if (l.zhanfa.yaoshu === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【妖术】`);
      l.zhanfa.yaoshu = 0;
      let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 2);
      if (arr.length > 0) {
        for (let u of arr) {
          if (u.zhuangtai.baozou.huihe) {
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>已存在暴走效果`);
          } else {
            u.zhuangtai.baozou.huihe = 2;
            u.zhuangtai.baozou.laiyuan = l;
            u.zhuangtai.baozou.laiyuanZhanfa = "妖术";
            u.zhuangtai.baozou.jilv = 1;
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的暴走效果已施加`);
          }
        }
      } else {
        zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
      }
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>战法【妖术】开始准备`);
      l.zhanfa.yaoshu = 1;
    }
  },
  樊渊泅囚: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("樊渊泅囚");
    if (l.zhanfa.fanyuan === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【樊渊泅囚】`);
      l.zhanfa.fanyuan = 0;
      let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 3);
      if (arr.length > 0) {
        for (let u of arr) {
          const sh = shanghai(zhanBao, l, u, 1.9);
          u.hp -= sh;
          if (u.hp <= 0) {
            u.hp = 0;
          }
          zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
          isJijiu(zhanBao, u);
          isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
          if (isOut(zhanBao,LR)) {
            return true;
          }
          if (u.zhuangtai.youyu.huihe) {
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>已存在犹豫效果`);
          } else {
            u.zhuangtai.youyu.huihe = 1;
            u.zhuangtai.youyu.laiyuan = l;
            u.zhuangtai.youyu.laiyuanZhanfa = "樊渊泅囚";
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的犹豫效果已施加`);
          }
        }
      } else {
        zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
      }
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>战法【樊渊泅囚】开始准备`);
      l.zhanfa.fanyuan = 1;
    }
  },
  九锡黄龙: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【九锡黄龙】`);
    let arr = l.lr === "l" ? lList : rList;
    if (arr.length > 0) {
      for (let u of arr) {
        u.zhuangtai.guibi.num = 2;
        u.zhuangtai.guibi.huihe = 999;
        u.zhuangtai.guibi.jilv = 1;
        u.zhuangtai.guibi.laiyuan = l;
        u.zhuangtai.guibi.laiyuanZhanfa = "九锡黄龙";
        zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的规避效果已施加`);
        ["hunluan", "youyu", "qiezhan", "baozou", "shanghaijiangdi", "weikun"].forEach((v) => {
          const t: any = u.zhuangtai;
          if (t[v].huihe && !t[v].bukeqingchu) {
            t[v].huihe = 0;
            t[v].num = 0;
            let a: any = ZhuangTaiMap;
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>的负面效果${a[v]}已清除`);
          }
        });
      }
    }
  },
  银龙孤胆: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[], tuichuWujiangList: Wujiang[], LR: Wujiang[]) => {
    const data = getZhanfa("银龙孤胆");
    if (l.zhanfa.yinlong === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【银龙孤胆】`);
      l.zhanfa.yinlong = 0;
      for (let i = 0; i < 7; i++) {
        let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, 5), 1);
        if (arr.length > 0) {
          for (let u of arr) {
            const sh = shanghai(zhanBao, l, u, 0.8 + i * 0.07);
            u.hp -= sh;
            if (u.hp <= 0) {
              u.hp = 0;
            }
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>损失${sh}兵力(${u.hp})`);
            isJijiu(zhanBao, u);
            isTuichu(zhanBao, u, uList, tuichuWujiangList, LR);
            if (isOut(zhanBao,LR)) {
              return true;
            }
          }
        } else {
          zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>范围内没有敌军`);
        }
      }
    } else if (random(Number(data!.probability))) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>战法【银龙孤胆】开始准备`);
      l.zhanfa.yinlong = 1;
    }
  },
  三军之众: (zhanBao: string[], l: Wujiang, uList: Wujiang[], lList: Wujiang[], rList: Wujiang[]) => {
    const data = getZhanfa("三军之众");
    if (l.zhanfa.sanjun === 1) {
      zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>发动战法【三军之众】`);
      l.zhanfa.sanjun = 0;
      for (let i = 0; i < 4; i++) {
        let arr: Wujiang[] = randomWujiang(getEnemyByZhanfa(zhanBao, l, uList, data!.distance as number, true, true), 1);
        if (arr.length > 0) {
          for (let u of arr) {
            const zl = lijiZhiliao(zhanBao, l, u, 1.51, 0.01575, 95.9);
            u.hp += zl;
            zhanBao.push(`<span class="${u.lr}">【${u.name}】</span>恢复${zl}兵力(${u.hp})`);
          }
        }
      }
    } else {
      if (random(Number(data!.probability))) {
        zhanBao.push(`<span class="${l.lr}">【${l.name}】</span>战法【三军之众】开始准备`);
        l.zhanfa.sanjun = 1;
      }
    }
  },
};
